import { _decorator, Button, Component, Node } from 'cc';
const { ccclass, property } = _decorator;

@ccclass('GameStart')
export class GameStart extends Component {

    @property({ type: Button })
    public startUIBtns: Button[] = [];

    @property({ type: Node })
    private creatorPlayUI: Node = null;


    start() {
        this.startUIBtns.forEach(button => {
            button.node.on(Button.EventType.CLICK, this.onstartUIBtnClick, this);
        });
    }

    update(deltaTime: number) {
        
    }

    onstartUIBtnClick(button:Button){
        const buttonName = button.node.name;
        if (buttonName === '开始游戏') {
            //打开创建角色界面
            this.creatorPlayUI.active=true;
        } else if (buttonName === '加载游戏') {
            //打开存档页面;
            console.log("打开存档");
        } else if (buttonName === '游戏设置') {
            //打开游戏设置面板;
            console.log("打开游戏设置");
        } else {
            //退出游戏;
            console.log("退出游戏");
        }
    }
    
}


